from selenium.webdriver.common.by import By


class AdminOrderMngLocator:
    # Ticket tab
    ticket_tab = (By.XPATH, "//div[contains(@data-menu-id,'TICKET')]")
    # Dashboard菜单
    dashboard_tab = (By.XPATH, "//div[contains(@data-menu-id,'DASHBOARD')]")
    # Bill菜单
    bill_tab = (By.XPATH, "//div[contains(@data-menu-id,'BILL')]")

    # usage query tab
    usage_query_tab = (By.CSS_SELECTOR, "[path='/console/orderManagement/usageQuery']")
    # orders_tab
    orders_tab = (By.CSS_SELECTOR, "[path='/console/orderManagement/order']")
    # empty_description
    empty_description = (By.CSS_SELECTOR, "div.antd4-empty-description")

    # email输入框
    email_input = (By.CSS_SELECTOR, "input#email")
    # email选项
    email_option = (By.XPATH, "//div[contains(@class, 'antd4-select-item-option')]")
    # product输入框
    product_input = (By.CSS_SELECTOR, "input#offerCode")

    # instanceId输入框
    instance_id_input = (By.CSS_SELECTOR, "input#instanceId")

    # 时间输入框
    start_time_input = (By.XPATH, "//input[@id='date']")
    end_time_input = (By.XPATH, "//input[@placeholder='Consumption End Time']")

    # search按钮
    search_button = (By.XPATH, "//button[contains(@class, 'antd4-btn-primary')]")

    # 数据行
    data_rows = (By.XPATH, "//tr[contains(@class, 'antd4-table-row')]")
    # 列
    table_columns = (By.XPATH, "//thead[contains(@class, 'antd4-table-thead')]//th")

    # 下载按钮
    download_button = (By.XPATH, "//span[contains(@aria-label, 'download')]/..")
    # 成功气泡提示
    success_pup = (By.XPATH, "//div[contains(@class, 'antd4-message-notice-content')]")

    # export records页面
    export_records_download_buttons = (By.XPATH, "//button[contains(@class, 'table-operation-btnLine-btn')]")
    export_records_download_buttons_disabled = (
        By.XPATH, "(//div[@class='table-operation'])[1]//button[@disabled and contains(@class, 'table-operation-btnLine-btn')]")

    # reload按钮
    export_records_reload_button = (By.XPATH, "//span[contains(@aria-label, 'reload')]/..")

    # orders 页面

    # 首行order ID
    orders_order_id = (By.XPATH, "//tbody//tr[2]//td[2]/div")
    # 首行view detail
    orders_view_detail = (By.XPATH, "//tbody//tr[2]//td[10]/a")

    # detail页面标题
    order_detail_title = (By.XPATH, "//div[@class='antd4-space-item'][1]")
    # detail页面返回按钮
    order_detail_back = (By.XPATH, "//span[contains(@class, 'cre-page-container-header-panel-back')]")

    # custType下拉选框
    orders_custType_input = (By.CSS_SELECTOR, "input#custType")
    # 结束时间输入框
    orders_end_time_input = (By.XPATH, "//input[@placeholder='End Date']")
    # 数据总量
    orders_total_items = (By.XPATH, "//li[contains(@class, 'antd4-pagination-total-text')]")

    # Export Records table columns
    export_records_table_columns = (By.XPATH, "//th[contains(@class, 'antd4-table-cell')]")
    # Export Records status
    export_records_status = (By.XPATH, "//span[contains(@class, 'antd4-badge-status-text')]")
    # Export Records status filter
    export_records_status_filter = (By.XPATH, "//th//span[contains(@role, 'button')]")
    # Export Records status filter item
    export_records_status_filter_item = (By.XPATH, "//li[contains(@class, 'antd4-dropdown-menu-item')]")
    # Export Records status filter reset
    export_records_status_filter_reset_button = (By.XPATH, "//span[text()='Reset']/..")
    # Export Records status filter ok
    export_records_status_filter_confirm_button = (By.XPATH, "//button[contains(@class, 'antd4-btn antd4-btn-primary')]")
    # Export Records download
    export_records_download = (By.XPATH, "//span[text()='Download']/..")
    # Export Records tab
    export_records_tab = (By.XPATH, "//div[text()='Export Records' and @class='cre-menu-layer-1']/..")
